15. Defined Adverbs
Names may be assigned to adverbs, as they are to nouns and verbs:
a=:1 2 3 4 5 prefix=: < prefix 'abcdefg' +-+--+---+----+-----+------+-------+ |a|ab|abc|abcd|abcde|abcdef|abcdefg| +-+--+---+----+-----+------+-------+ +/ prefix a 1 3 6 10 15
Moreover, new adverbs result from a string of adverbs
(such as /) and from a conjunction
together with one of its arguments.
Such adverbs can be defined by assigning names. Thus:
IP=: / NB. Insert Prefix + IP a 1 3 6 10 15 with3=: &3 % with3 a 0.333333 0.666667 1 1.33333 1.66667 ^ with3 a 1 8 27 64 125 I=: ^: _1 NB. Inverse adverb *: I a 1 1.41421 1.73205 2 2.23607 + IP I 1 3 6 10 15 1 2 3 4 5 ten=: 10& ^. ten 5 10 20 100 0.69897 1 1.30103 2 #. ten 3 6 5 365 from=: -~ into=: %~ 10 into 17 18 19 1.7 1.8 1.9 10 from 17 18 19 7 8 9 i=: "_1 NB. Apply to items {. i i. 3 4 0 4 8
Exercises
15.1 | Experiment with, and explain the behaviour of, the adverbs pow=: ^& and log=: &^. |
|||||||||||||
15.2 | State the significance of the following expressions, and test your conclusions by entering them:
|